#!/bin/bash

# 检查是否为root用户
if [ "$EUID" -ne 0 ]; then
  echo "请使用root权限运行此脚本"
  exit 1
fi

# 安装Python包管理工具pip（如果尚未安装）
install_pip() {
    echo "正在安装pip..."
    apt-get update
    apt-get install -y python3-pip
}

# 安装NumPy
install_numpy() {
    echo "正在安装NumPy..."
    pip3 install numpy
}

# 安装OpenCV
install_opencv() {
    echo "正在安装OpenCV..."
    pip3 install opencv-python
}

# 安装PyYAML
install_pyyaml() {
    echo "正在安装PyYAML..."
    pip3 install pyyaml
}

# 安装Gazebo ROS插件
install_gazebo_ros_plugins() {
    echo "正在安装Gazebo ROS插件..."
    sudo apt-get install -y ros-noetic-gazebo-ros-pkgs ros-noetic-gazebo-ros-control
}


# 主函数
main() {
    install_pip
    install_numpy
    install_opencv
    install_pyyaml
    echo "所有Python库安装完成！"
    install_gazebo_ros_plugins
    echo "Gazebo ROS插件安装完成！"

}

# 运行主函数
main